from PyQt5.QtWidgets import (
    QHBoxLayout,
    QApplication,
    QWidget,
    QTabWidget,
    QVBoxLayout,
    QLabel,
    QPushButton,
)
# vertical https://github.com/yjg30737/pyqt-vertical-tab-widget


class TabWidgetDemo(QWidget):
    def __init__(self):
        super().__init__()
        self.resize(1300, 1200)
        self.tab_widget = QTabWidget()
        self.tab1 = QWidget()
        self.tab2 = QWidget()
        self.btn1 = QPushButton("1 Button", self.tab1)

        self.tab_widget.addTab(self.tab1, "Tab 1")
        self.tab_widget.addTab(self.tab2, "Tab 2")

        layout = QHBoxLayout()
        layout.addWidget(self.tab_widget)
        self.setLayout(layout)

        # 切换到 Tab 2
        self.tab_widget.setCurrentIndex(1)


if __name__ == "__main__":
    app = QApplication([])
    demo = TabWidgetDemo()
    demo.show()
    app.exec_()
